package cn.dengta.webapp.im.enums;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.common.model.ValueProxyImpl;
import cn.dengta.common.util.Common;

public enum GreetBizType implements ValueProxyImpl<GreetBizType, Integer> {

	HOME(0, "首页"),
	MOMENT(1, "动态"),
	;
	public final Integer value;
	final String label;
	final ValueProxy<GreetBizType, Integer> proxy;

	GreetBizType(Integer value, String label) {
		this.value = value;
		this.label = label;
		this.proxy = new ValueProxy<>(this, value, label);
	}

	public static final GreetBizType[] CACHE = values();

	public static GreetBizType of(final int val) {
		return Common.getEnum(CACHE, GreetBizType::getValue, val);
	}

	public static GreetBizType ofDefault(Integer val) {
		GreetBizType result = Common.getEnum(CACHE, GreetBizType::getValue, val);
		return result == null ? HOME : result;
	}

	public static String getLabel(final int val) {
		final GreetBizType status = of(val);
		return status == null ? null : status.getLabel();
	}

	@Override
	public ValueProxy<GreetBizType, Integer> getProxy() {
		return proxy;
	}
}
